package org.bright.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;

import javax.sql.DataSource;

public class JdbcConfig {
    @Value("${driver}")
    private String driverName;
    @Value("${url}")
    private String url;
    @Value("${user}")
    private String userName;
    @Value("${password}")
    private String password;
    @Bean
    public DataSource dataSource(){
        DruidDataSource laboratoryDataSource  =  new DruidDataSource();
        laboratoryDataSource.setUsername(driverName);
        laboratoryDataSource.setUrl(url);
        laboratoryDataSource.setUsername(userName);
        laboratoryDataSource.setPassword(password);
        return laboratoryDataSource;
    }
}
